<%-- 
    Document   : ModifyStaff
    Created on : Nov 22, 2012, 10:52:32 AM
    Author     : vupttse
--%>

<%@page import="com.sun.org.apache.xerces.internal.impl.dv.dtd.ENTITYDatatypeValidator"%>
<%@page import="ass.data.UserDAL"%>
<%@page import="ass.data.UserEntity"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="../css/modern.css" rel="stylesheet">
        <link href="../css/modern-responsive.css" rel="stylesheet">
        <link href="../css/site.css" rel="stylesheet" type="text/css">

        <script src="../js/jquery-1.8.2.min.js"></script>
        <script src="../js/google-analytics.js"></script>
        <script src="../js/github.info.js"></script>
        <script src="../js/sharrre/jquery.sharrre-1.3.4.min.js"></script>
        <script src="../js/carousel.js"></script>
        <script src="../js/dropdown.js"></script>
        <script src="../js/slider.js"></script>
        <script src="../js/hover.js"></script>
        <script src="../js/pagecontrol.js"></script>
        <script src="../js/accordion.js"></script>

        <script>
            //            Validate the input of the form when submit
            function validateForm()
            {
                var x=document.forms["EditStaffForm"]["username"].value;
                var y=document.forms["EditStaffForm"]["password"].value;
                if (x==null || x=="" || y==null || y=="")
                {
                    alert("Please enter username and password!");
                    return false;
                }
            }
        </script>
        <title>Modify Staff</title>
    </head>
    <body>
        <%
            String username = request.getParameter("username");
            if (username != null) {
                UserEntity entity = UserDAL.searchByUsername(username);%>

        <div class="page with-sidebar">
            <jsp:include page="NavigationBar.jsp"></jsp:include>
            <%@include file="SideBar" %> 
            <div class="page-region">
                <div class="page-region-content bg-color-white">
                    <div class="grid">
                        <div class="row">

                            <div class="span8" style="height: 400px; margin-left: 20px; margin-top: 10px;">
                                <h1 class="fg-color-blue">Edit Staff Profile</h1>
                                <form name="EditStaffForm" action="EditingStaff.jsp" method="get" onsubmit="return validateForm()">
                                    <table>
                                        <tr>
                                            <td>UserName</td>
                                            <td><input type="text" readonly="true" name="username" value="<%=entity.getUsername()%>"></td>
                                        </tr>
                                        <tr>
                                            <td>Gender</td>
                                            <td>
                                                <label class="radiobox">
                                                    <input type="radio" name="gender" value="Male" checked="<%=entity.getGender().trim().equals("Male")%>">
                                                    <span>Male</span>   
                                                </label>
                                                <label class="radiobox">
                                                    <input type="radio" name="gender" value="Female" checked="<%=entity.getGender().trim().equals("Female")%>">
                                                    <span>Female</span>                                                                                                   
                                                </label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Full Name</td>
                                            <td><input type="text" name="fullName" value="<%=entity.getFullName().trim()%>"></td>
                                        </tr>
                                        <tr>
                                            <td>Telephone Number</td>
                                            <td><input type="text" name="tel" value="<%=entity.getTel().trim()%>"></td>
                                        </tr>
                                        <tr>
                                            <td>Address</td>
                                            <td><input type="text" name="address" value="<%=entity.getAddress().trim()%>"></td>
                                        </tr>
                                        <tr>
                                            <td>Nationality</td>
                                            <td><input type="text" name="nationality" value="<%=entity.getNationality().trim()%>"></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td><input type="submit" value="Update">
                                                <input type="reset" value="Default"></td>
                                        </tr>
                                    </table>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <%@include file="Footer" %>
        </div>
        <%}
        %>
    </body>
</html>
